//index.js
//获取应用实例
var app = getApp();
var config = require("../../config.js");
Page({
  data: {
    id:"",
    school: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/school.png',
    indextel: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/indextel.png',
    weizhi: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/weizhi.png',
    a1src: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/a1.png',
    a2src: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/a2.png',
    a3src: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/a3.png',
    a4src: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/a4.png',
    signupimg: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/signup.png',
    imgsrc: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/java1.jpg',
    iconsrc: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/usercount.png',
    jtsrc: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/icon-jt.png',
    imgUrls: [
      'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/lunbo2.jpg',
      'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/lunbo3.jpg',
      'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/lunbo1.jpg',
    ],
    photos: [
      'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/p1.jpg',
      'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/p2.jpg',
      'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/p3.jpg',
      'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/p4.jpg',
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    navs: [{
      url: '/pages/liucheng/index',
      image: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/liucheng.png',
      text: '成绩单'
    }, {
      url: '/pages/teacher/teacher',
      image: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/szll.png',
      text: '教师风采'
    }, {
      url: '/pages/xueyuan/index',
      image: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/xy.png',
      text: '培养方案'
    }, {
      url: '/pages/about/about',
      image: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/gywm.png',
      text: '关于我们'
    }],
    teachernavs: [
      {
        url: "/pages/teacher/teacher",
        image:
          "https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/szll.png",
        text: "教师风采",
      },
      {
        url: "/pages/teacherstudent/teacherstudent",
        image:
          "https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/xy.png",
        text: "学生列表",
      },
      {
        url: "/pages/courselist/courselist",
        image:
          "https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/xy.png",
        text: "学生申诉",
      },
      {
        url: '/pages/about/about',
        image: 'https://demo-1305283561.cos.ap-nanjing.myqcloud.com/image/gywm.png',
        text: '关于我们'
      }
    ],
    teacher:false
  },
  //功能导航到点击界面中
  gotopage: function (event) {
    console.log(event)
    wx.navigateTo({
      url: event.currentTarget.dataset.hi+"?id="+this.data.id
    })
  },
  onShareAppMessage: function (res) {
    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res.target)
    }
    return {
      title: '培训机构首页',
      path: '/pages/index/index',
      success: function (res) {
        // 转发成功
        console.log("转发成功")
      },
      fail: function (res) {
        // 转发失败
        onsole.log("转发失败")
      }
    }
  },
  onLoad: function (options) {
    var that = this;
    if(options.teacher != undefined && options.teacher !="") {
      that.setData({
        teacher:true
      })
    }
    console.log(config.courses);
    that.setData({
      courses: config.courses,
      id:options.id
    });
    //调用应用实例的方法获取全局数据
    app.getUserInfo(function (userInfo) {
      //更新数据
      that.setData({
        userInfo: userInfo
      })
    })
  },
  
  /*
  calling: function () 
  {
    wx.makePhoneCall({
      phoneNumber: config.telphone,
      success: function () {
        console.log("拨打电话成功！")
      },
      fail: function () {
        console.log("拨打电话失败！")
      }
    })
  },
  onShareAppMessage: function () {
    return {
      title: 'XXXXX培训机构',
      desc: '培训的领军者!',
      path: '/page/index/index'
    }
  },
  jumpToCourse: function () {
    wx.navigateTo({
      url: "/pages/new_course/course"
    })
  }*/
})
